package com.example.hospital_208.service.impl;

import com.example.hospital_208.dao.DoctorWorkDao;
import com.example.hospital_208.po.DoctorWork;
import com.example.hospital_208.service.DoctorWorkService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DoctorWorkServiceImpl implements DoctorWorkService {

    private final DoctorWorkDao doctorWorkDao;

    public DoctorWorkServiceImpl(DoctorWorkDao doctorWorkDao) {
        this.doctorWorkDao = doctorWorkDao;
    }

    @Override
    public List<DoctorWork> listDoctorWorks() {
        return doctorWorkDao.findAllDoctorWorks();
    }

    @Override
    public DoctorWork getDoctorWorkByDocIdAndDay(String doc_id, String day) {
        return doctorWorkDao.findDoctorWorkByDocIdAndDay(doc_id, day);
    }

    @Override
    public List<DoctorWork> getDoctorWorksByDocId(String doc_id) {
        return doctorWorkDao.findDoctorWorksByDocId(doc_id);
    }

    @Override
    public List<DoctorWork> getDoctorWorksByDay(String day) {
        return doctorWorkDao.findDoctorWorksByDay(day);
    }

    @Override
    public int addDoctorWork(DoctorWork doctorWork) {
        return doctorWorkDao.insertDoctorWork(doctorWork);
    }

    @Override
    public int editDoctorWork(DoctorWork doctorWork) {
        return doctorWorkDao.updateDoctorWork(doctorWork);
    }

    @Override
    public int removeDoctorWork(String doc_id, String day) {
        return doctorWorkDao.deleteDoctorWorkByDocIdAndDay(doc_id, day);
    }

    @Override
    public int removeDoctorWorksByDocId(String doc_id) {
        return doctorWorkDao.deleteDoctorWorksByDocId(doc_id);
    }
}